cmake_minimum_required(VERSION 3.2)
project(ZeroTierOneJNI)
find_package(Java COMPONENTS Development)
file(GLOB core_src_glob jni/node/*.cpp)
set(src_files
        jni/osdep/OSUtils.cpp
        jni/com_zerotierone_sdk_Node.cpp
        jni/ZT_jniutils.cpp
        jni/ZT_jnicache.cpp
)
set(include_dirs
        ${CMAKE_CURRENT_SOURCE_DIR}/jni/include/
        ${CMAKE_CURRENT_SOURCE_DIR}/jni/node/
        ${CMAKE_CURRENT_SOURCE_DIR}/jni/ext/
        ${CMAKE_CURRENT_SOURCE_DIR}/jni/ext/prometheus-cpp-lite-1.0/core/include/
        ${CMAKE_CURRENT_SOURCE_DIR}/jni/ext/prometheus-cpp-lite-1.0/simpleapi/include/)
include_directories(
        ${include_dirs}
)
add_library(${PROJECT_NAME} SHARED ${src_files} ${core_src_glob})
set(link_libs log)
target_link_libraries(${PROJECT_NAME} ${link_libs})

#todo:build.gradle中需要支持的结构在这里加上
set(ANDROID_ABI armeabi-v7a arm64-v8a x86 x86_64)
foreach(arch ${ANDROID_ABI})
    message("添加要构建的架构:${arch}")
    set_target_properties(${PROJECT_NAME} PROPERTIES
            COMPILE_FLAGS "-DANDROID_ABI=${arch}")
endforeach()
